package com.songlanyun.modules.singlegoods.service;

import com.songlanyun.common.drive.IBaseService;
import com.songlanyun.common.enums.GoodsConstant;
import com.songlanyun.modules.singlegoods.entity.ProductSingleGoodsEntity;
import com.songlanyun.modules.singlegoods.model.OrderStockTo;

/**
 * 商家的单品表，用来管理库存
 *
 * @author lubo
 * @email sunlightcs@gmail.com
 * @date 2020-11-04 09:03:01
 */
public interface ProductSingleGoodsService extends IBaseService<Long, ProductSingleGoodsEntity> {

    ProductSingleGoodsEntity loadByShopIdAndId(Long shopId, Long id);
    ProductSingleGoodsEntity getByShopIdAndId(Long shopId, Long id);

    ProductSingleGoodsEntity add(Long shopId, ProductSingleGoodsEntity entity);
    ProductSingleGoodsEntity update(Long shopId,ProductSingleGoodsEntity entity);
    void delete(Long shopId,Long id);

    //手动入库
    void manualInStock(Long shopId,Long singleGoodsId,int changeStock);
    //手动出库
    void manualOutStock(Long shopId, Long singleGoodsId, int changeStock);

    //下单购买商品出库
    void orderOutStock(Long shopId, OrderStockTo orderStockTo);

    //订单取消支付回退库存
    void cancelPayInStock(Long shopId, OrderStockTo orderStockTo, GoodsConstant.InStockType inStockType);

    //维权单商家手动入库
    void rightsChildOrderInStock(Long shopId, OrderStockTo orderStockTo);

    void added(Long shopId, Long id);

    Integer rarelyGoodsNum(Long shopId, Integer num);

    ProductSingleGoodsEntity loadByIdForLock(Long shopId,Long id,boolean tw);

    ProductSingleGoodsEntity loadByShopIdAndCount(Long shopId, String code);
}

